<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
</head>
<body>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	<form class="form-horizontal" onsubmit="return false" id="form">
		<fieldset>
			<input type="hidden" id="id" name="id">
			<div class='form-group'>
				<label class='col-md-2 control-label'>workNo</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='workNo' type='text' name='workNo' id='workNo' data-bv-notempty='true' data-bv-notempty-message='workNo 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>snNo</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='snNo' type='text' name='snNo' id='snNo' data-bv-notempty='true' data-bv-notempty-message='snNo 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>woNo</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='woNo' type='text' name='woNo' id='woNo' data-bv-notempty='true' data-bv-notempty-message='woNo 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>pmId</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='pmId' type='text' name='pmId' id='pmId' data-bv-notempty='true' data-bv-notempty-message='pmId 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>engineerId</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='engineerId' type='text' name='engineerId' id='engineerId' data-bv-notempty='true' data-bv-notempty-message='engineerId 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>woClassifyMain</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='woClassifyMain' type='text' name='woClassifyMain' id='woClassifyMain' data-bv-notempty='true' data-bv-notempty-message='woClassifyMain 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>woClassifyDetail</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='woClassifyDetail' type='text' name='woClassifyDetail' id='woClassifyDetail' data-bv-notempty='true' data-bv-notempty-message='woClassifyDetail 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>woStatus</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='woStatus' type='text' name='woStatus' id='woStatus' data-bv-notempty='true' data-bv-notempty-message='woStatus 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>woType</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='woType' type='text' name='woType' id='woType' data-bv-notempty='true' data-bv-notempty-message='woType 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>serviceType</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='serviceType' type='text' name='serviceType' id='serviceType' data-bv-notempty='true' data-bv-notempty-message='serviceType 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>service</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='service' type='text' name='service' id='service' data-bv-notempty='true' data-bv-notempty-message='service 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>serviceStation</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='serviceStation' type='text' name='serviceStation' id='serviceStation' data-bv-notempty='true' data-bv-notempty-message='serviceStation 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>woGrade</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='woGrade' type='text' name='woGrade' id='woGrade' data-bv-notempty='true' data-bv-notempty-message='woGrade 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>woClient</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='woClient' type='text' name='woClient' id='woClient' data-bv-notempty='true' data-bv-notempty-message='woClient 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>woClientStation</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='woClientStation' type='text' name='woClientStation' id='woClientStation' data-bv-notempty='true' data-bv-notempty-message='woClientStation 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>woDeviceId</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='woDeviceId' type='text' name='woDeviceId' id='woDeviceId' data-bv-notempty='true' data-bv-notempty-message='woDeviceId 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>description</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='description' type='text' name='description' id='description' data-bv-notempty='true' data-bv-notempty-message='description 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>projectId</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='projectId' type='text' name='projectId' id='projectId' data-bv-notempty='true' data-bv-notempty-message='projectId 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>templateId</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='templateId' type='text' name='templateId' id='templateId' data-bv-notempty='true' data-bv-notempty-message='templateId 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>advComTime</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='advComTime' type='text' name='advComTime' id='advComTime' data-bv-notempty='true' data-bv-notempty-message='advComTime 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>totalCostTime</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='totalCostTime' type='text' name='totalCostTime' id='totalCostTime' data-bv-notempty='true' data-bv-notempty-message='totalCostTime 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>beginTime</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='beginTime' type='text' name='beginTime' id='beginTime' data-bv-notempty='true' data-bv-notempty-message='beginTime 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>isIndependent</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='isIndependent' type='text' name='isIndependent' id='isIndependent' data-bv-notempty='true' data-bv-notempty-message='isIndependent 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>assitBy</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='assitBy' type='text' name='assitBy' id='assitBy' data-bv-notempty='true' data-bv-notempty-message='assitBy 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>needAssitReason</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='needAssitReason' type='text' name='needAssitReason' id='needAssitReason' data-bv-notempty='true' data-bv-notempty-message='needAssitReason 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>remarks</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='remarks' type='text' name='remarks' id='remarks' data-bv-notempty='true' data-bv-notempty-message='remarks 不能为空'>
				</div>
			</div>



			<div class="form-actions">
				<div class="row" align="center">
					<div class="col-md-12">
					    <button class="btn btn-primary" onclick="location.href='woWorksheetList.html'">返回</button>
						<button class="btn btn-primary" type="submit" onclick="update()">
							<i class="fa fa-save"></i> 保存
						</button>
					</div>
				</div>
			</div>

		</fieldset>
	</form>
</div>
	<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="../../js/jq.js"></script>
	<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript">
		layui.use(['layer','laydate'], function(){
		    var layer = layui.layer;
		});
		
		initData();
		
		function initData(){
			var id = getUrlParam("id");
			if(id != ""){
				$.ajax({
					type : 'get',
					url : '/woWorksheets/'+id,
					async : false,
					success : function(data) {
						$('#id').val(data.id);
						$('#workNo').val(data.workNo);
						$('#snNo').val(data.snNo);
						$('#woNo').val(data.woNo);
						$('#pmId').val(data.pmId);
						$('#engineerId').val(data.engineerId);
						$('#woClassifyMain').val(data.woClassifyMain);
						$('#woClassifyDetail').val(data.woClassifyDetail);
						$('#woStatus').val(data.woStatus);
						$('#woType').val(data.woType);
						$('#serviceType').val(data.serviceType);
						$('#service').val(data.service);
						$('#serviceStation').val(data.serviceStation);
						$('#woGrade').val(data.woGrade);
						$('#woClient').val(data.woClient);
						$('#woClientStation').val(data.woClientStation);
						$('#woDeviceId').val(data.woDeviceId);
						$('#description').val(data.description);
						$('#projectId').val(data.projectId);
						$('#templateId').val(data.templateId);
						$('#advComTime').val(data.advComTime);
						$('#totalCostTime').val(data.totalCostTime);
						$('#beginTime').val(data.beginTime);
						$('#isIndependent').val(data.isIndependent);
						$('#assitBy').val(data.assitBy);
						$('#needAssitReason').val(data.needAssitReason);
						$('#remarks').val(data.remarks);

					}
				});
			}
		}

		function update() {
			$('#form').bootstrapValidator();
			var bootstrapValidator = $("#form").data('bootstrapValidator');
			bootstrapValidator.validate();
		    if(!bootstrapValidator.isValid()){
			   return;
		    }
		    
		    var formdata = $("#form").serializeObject();

			$.ajax({
				type : 'put',
				url : '/woWorksheets',
				contentType: "application/json; charset=utf-8",  
				data : JSON.stringify(formdata),
				success : function(data) {
					layer.msg("修改成功", {shift: -1, time: 1000}, function(){
                        location.href = "woWorksheetList.html";
                    });
				}
			});
		}
		
	</script>
</body>
</html>
